/*
 * @Author: guowu
 * @Date: 2022-02-10 14:01:51
 * @LastEditTime: 2022-02-12 10:37:27
 */

export type FizzBuzzType = number | string;
import {Fizz,Buzz,Whizz,FizzBuzzWhizz,FizzBuzz,FizzWhizz,BuzzWhizz} from './rule'
const fizzBuzzConverter = (number: number): FizzBuzzType => {
    if(String(number).includes('3')) return Fizz()
    if(number % 3 === 0 && number % 5 === 0 && number % 7 === 0) return FizzBuzzWhizz()
    if(number % 3 === 0 && number % 5 === 0 ) return FizzBuzz()
    if(number % 3 === 0 && number % 7 === 0 ) return FizzWhizz()
    if(number % 5 === 0 && number % 7 === 0 ) return BuzzWhizz()
    if(number % 3 === 0) return Fizz()
    if(number % 5 === 0) return Buzz()
    if(number % 7 === 0) return Whizz()
    if(String(number).includes('5')&&number % 5 === 0 && number % 7 === 0 ) return BuzzWhizz()
    if(String(number).includes('5')&&number % 5 === 0 && number % 7 !== 0 ) return Buzz()
    if(String(number).includes('5')&&number % 5 !== 0 && number % 7 === 0 ) return String(number)
    if(String(number).includes('7')&&number % 3 === 0 && number % 7 === 0 ) return String(number)
    if(String(number).includes('7')&&number % 3 === 0 && number % 7 !== 0 ) return Fizz()
    if(String(number).includes('7')&&number % 3 !== 0 && number % 7 === 0 ) return Whizz()
    else return String(number)
}
export default fizzBuzzConverter;